package com.atguigu;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class test {
    /*
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss a");
Date date = sdf.parse("2016/11/18 10:31:37 AM");//String-->Date
Long dateLong = date.getTime();//Date-->Long
     */

    public static void main(String[] args){
        /*SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
        Date date = null;
        try {
            date = sdf.parse("2022-02-23 20:10:32");
        } catch (ParseException e) {
            e.printStackTrace();
        }*/
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
        Date parse = null;
        try {
             parse = sdf.parse("2022-02-23 20:10:32");
        } catch (ParseException e) {
            e.printStackTrace();
        }


        Long dateLong = parse.getTime();
        System.out.println("dateLong = " + dateLong);
    }
}
